package cn.bdqn.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class FirstServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       //设置响应的文本格式
        resp.setContentType("text/html;charset=utf-8");
        resp.setCharacterEncoding("utf-8");
        //获取out对象
        PrintWriter out=resp.getWriter();
        String str=getInitParameter("test");
        String chen=this.getServletContext().getInitParameter("testapp");
        //写入内容
        out.print("<h1>"+str+"</h1>");
        out.print("<h1>"+chen+"</h1>");
        out.flush();
        out.close();

    }
}
